{include file="Public:header" /}
 <link rel="stylesheet" href="__PUBLIC__/Admin/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css" media="screen"/>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>添加规则</h5>
                        <div class="ibox-tools" style="margin-top: -6px;">
                            <button onclick="history.go(-1);" class="btn btn-primary"><i class="fa fa-arrow-left"></i> 返回</button>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form action="__URL__/addRule" method="post" id="defaultForm" class="form-horizontal">
                        
                            <div class="form-group">
                                <label class="col-sm-2 control-label">规则名称</label>
                                 <div class="col-sm-6">
                                    <input type="text" name="rule_name" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <!--<div class="form-group">
                                <label class="col-sm-2 control-label">活动项目</label>
                                <div class="col-sm-6">
                                    <select name="a_id" class="form-control">
                                    {foreach name="acti" item="acti"}
										<option value="{$acti['activity_id']}">{$acti['activity_name']}</option>
									{/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>-->
                            
                            <!--<div class="form-group">
                                <label class="col-sm-2 control-label">循环天数</label>
                                <div class="col-sm-6">
                                   <select name="loop_day" class="form-control">
                                   		<option value="0">0</option>
                                   		<option selected value="1">1</option>
                                   </select>	
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">抽奖次数</label>
                                <div class="col-sm-6">
                                    <input type="text" name="day_num" class="form-control">
                                    <span>该活动每天最多可抽奖次数</span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>-->

                             <div class="form-group">
                                <label class="col-sm-2 control-label">抽奖机会</label>
                                <div class="col-sm-6">
                                    <input type="text" name="most_num" class="form-control">
                                    <span>每个用户每天最多能使用几次抽奖机会</span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div> 

                            <div class="form-group">
                                <label class="col-sm-2 control-label">实物抽奖次数</label>
                                <div class="col-sm-6">
                                    <input type="text" name="matter_num" class="form-control">
                                    <span>每个用户在活动期间最多只能抽中几次实物礼品</span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div> 
                            
                            <div class="form-group form-inline" >
                             <label class="col-sm-2 control-label">开始、结束时间</label>
                                <div class="col-sm-8">
                                   <div class="col-sm-4 input-group date" id="datetimepicker6">
						                <input type="text" name="statr_time" value="2017-01-01 00:00" readonly="true" class="form-control">
						                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
						                <span class="input-group-addon">
						                    <span class="fa fa-calendar"></span>
						                </span>
						            </div>
						            
						            <div class="col-sm-4 input-group date" id="datetimepicker7">
						                <input type="text" name="end_time" value="2017-01-01 00:00" readonly="true" class="form-control">
						                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
						                <span class="input-group-addon">
						                    <span class="fa fa-calendar"></span>
						                </span>
						            </div>
                              </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit">保存</button>
                                    <button class="btn btn-white" type="submit">取消</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
				</div>
			</div>
		</div>
	</div>


	{include file="Public:footer" /}

	<script>
$(document).ready(function() {
    /**
     * 下面是进行插件初始化
     * 你只需传入相应的键值对
     * */
    $('#defaultForm').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {/*输入框不同状态，显示图片的样式*/
            	  valid: 'glyphicon glyphicon-ok',
                  invalid: 'glyphicon glyphicon-remove',
                  validating: 'glyphicon glyphicon-refresh'
            },
            fields: {/*验证*/
            	rule_name: {/*键名username和input name值对应*/
                    message: '规则名称验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '规则名称不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 2,
                            max: 30,
                            message: '规则名称长度必须在2到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                a_id: {/*键名username和input name值对应*/
                    message: '活动项目验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '活动项目不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 2,
                            max: 30,
                            message: '活动项目长度必须在2到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                loop_day: {/*键名username和input name值对应*/
                    message: '循环天数验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '循环天数不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 1,
                            max: 30,
                            message: '循环天数长度必须在1到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                day_num: {/*键名username和input name值对应*/
                    message: '抽奖次数验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '抽奖次数不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 1,
                            max: 30,
                            message: '抽奖次数长度必须在1到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                statr_time:{/*键名username和input name值对应*/
                    message: '开始时间验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '开始时间不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 2,
                            max: 30,
                            message: '开始时间长度必须在2到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                end_time:{/*键名username和input name值对应*/
                    message: '结束时间验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '结束时间不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 2,
                            max: 30,
                            message: '结束时间长度必须在2到30之间'
                        }/*最后一个没有逗号*/
                    }
                }
               
            }
            // 还有一个比较常用的就是submitHandler属性，它对应着提交按钮的事件方法。
            // submitHandler: function (validator, form, submitButton) {
                //alert("submit");
               /*  var menu_name = $("input[name='menu_name']").val();
                var link = $("input[name='link']").val();
                var ico = $("input[name='ico']").val();
                $.ajax({
                    url : '__URL__/addMenu',
                    type : 'get',
                    data : {'menu_name' : menu_name, 'link' : link, 'ico':ico},
                    dataType : 'json',
                    success : function(data){
                      alert(data.message);
                    }
                }); */
           // }
        });
});

</script>

<script type="text/javascript" src="__PUBLIC__/Admin/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>

<script type="text/javascript">
        $('#datetimepicker6').datetimepicker({
             language:  'zh-CN',
             format: 'yyyy-mm-dd HH:ii',
             autoclose:true//日期选择完成后是否关闭选择框
        });
        $('#datetimepicker7').datetimepicker({
            language:  'zh-CN',
            format: 'yyyy-mm-dd HH:ii',
            autoclose:true //Important! See issue #1075
        });
   
</script>

</body>
</html>
